class_name PlayerClimbState
extends GameplayState

@onready var player: Player = $"../../"


func _on_enter() -> void:
	player.play_animation("climb")

	player.add_tag(GameplayTagLibrary.State_Climb)

	player.velocity = Vector2.ZERO


func _on_update(delta: float) -> void:
	var movement_input := player.input_handler.get_vector("move_left", "move_right", "climb", "crouch")
	player.velocity = movement_input * player.get_attribute("climb_speed").current_value * delta

	if movement_input:
		player.play_animation("climb")
	else:
		player.stop_animation()


func _on_exit() -> void:
	player.remove_tag(GameplayTagLibrary.State_Climb)
